home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / C++ A'Link Files / Jan 91 / CPlus.Dev$ 1⁄25⁄91 / 0264-Re[2] >const vs #def-Jan91 < prev    next >
Encoding:
Text File  |  1991-03-06  |  1.6 KB  |  45 lines  |  [TEXT/GEOL]

  1. Item    1745294                         23-Jan-91        14:57
  2.  
  3. From:   LSR@APPLE.COM@INTERNET#         Gateway to Internet/BITNET/UUCP
  4.  
  5. To:     CPLUS.APPLE$                    C++ Interest List--Apple Employees
  6.  
  7. Item forwarded by       BEISEL       to WANG2 
  8.  
  9. Item forwarded by       TIM.SWIHART  to CPLUS.DEV$ 
  10.  
  11. INTERNET# Document Id: <11824@goofy.Apple.COM>
  12.  
  13. ------------------------------------------------------------------------------
  14.  
  15. Sub:    Re: RE>>const vs #define in C
  16.  
  17. If you use AppleLink 6.0, you win! The Reply button works for gatewayed E-mail.
  18. Otherwise, copy & paste this: lsr@Apple.com@INTERNET#
  19.  
  20. From: lsr@Apple.com (Larry Rosenstein)
  21. References: <2415334@AppleLink.Apple.COM>
  22. Lines: 14
  23. Organization: Apple Computer, Inc.
  24. Newsgroups: apple.lang.c++
  25. Path: apple!lsr
  26. Sender: usenet@Apple.COM
  27. To: cplus.apple$@applelink.apple.com
  28.  
  29.  
  30. In article <2415334@AppleLink.Apple.COM>, V0629@AppleLink.Apple.COM (New Engl
  31. and Digital,R & D,ASC,VAR) writes:
  32. >
  33. > This is very easy to explain.  #define is not at all the same as const.
  34. > #define is a preprocessor directive causing a textual substitution BEFORE the
  35. > compiler scans the code.  Therefore, #define symbols do not appear in the
  36. > symbol table.
  37.  
  38. I think #define symbols do appear in the dump file, since when the dump
  39. file is loaded those symbols will end up being defined.  You are right,
  40. however, that there is a difference between const ints and #defines.
  41. Certainly the compiler must save the full type information for a const int,
  42. while a #define is untyped.  If the constant is a small number, then the
  43. textual representation will be smaller than its binary representation.
  44.  
  45.